package com.lie.prepare.sort;

import org.junit.Test;

import static com.lie.prepare.sort.util.MyArrayHelper.getArray;
import static com.lie.prepare.sort.util.MyArrayHelper.printArraySort;

/**
 * Created by lie on 2018/4/18.
 */
public class SelectSort {

    public static void doSort(){
        int[] array = getArray();

        for (int outI = 0; outI < array.length; outI++) {
            int indexLow = outI;
            for (int i = outI; i < array.length; i++) {
                if (array[i] < array[indexLow]){
                    indexLow = i;
                }
            }

            int temp = array[outI];
            array[outI] = array[indexLow];
            array[indexLow] = temp;
        }

        printArraySort(array);
    }

    @Test
    public void test(){
        doSort();
    }


}
